Socket
Socket
Sign inDemoInstall

@walletconnect/core

Package Overview
Dependencies
3
Maintainers
5
Versions
526
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/core


Version published
Weekly downloads
446K
decreased by-3.04%
Maintainers
5
Install size
2.36 MB
Created
Weekly downloads
 

Package description

What is @walletconnect/core?

@walletconnect/core is a core library for WalletConnect, a protocol for connecting decentralized applications (dApps) to mobile wallets with QR code scanning or deep linking. It allows developers to integrate WalletConnect functionality into their applications, enabling secure and seamless interactions between dApps and wallets.

What are @walletconnect/core's main functionalities?

Initialize WalletConnect

This code initializes a WalletConnect connector with a specified bridge server and QR code modal. The connector is the main interface for establishing a connection between a dApp and a wallet.

const WalletConnect = require('@walletconnect/core');
const connector = new WalletConnect({
  bridge: 'https://bridge.walletconnect.org',
  qrcodeModal: QRCodeModal,
});

Create Session

This code creates a new WalletConnect session and generates a URI that can be displayed as a QR code. The QR code allows users to scan and connect their wallet to the dApp.

connector.createSession().then(() => {
  const uri = connector.uri;
  QRCodeModal.open(uri, () => {
    console.log('QR Code Modal closed');
  });
});

Send Transaction

This code listens for a successful connection event and then sends a transaction from the connected wallet. The transaction details such as recipient address, amount, and gas limit are specified in the `tx` object.

connector.on('connect', (error, payload) => {
  if (error) {
    throw error;
  }
  const { accounts } = payload.params[0];
  const tx = {
    from: accounts[0],
    to: '0xRecipientAddress',
    value: '0xAmountInWei',
    gas: '0xGasLimit',
  };
  connector.sendTransaction(tx).then((result) => {
    console.log('Transaction sent:', result);
  }).catch((error) => {
    console.error('Transaction error:', error);
  });
});

Other packages similar to @walletconnect/core

Readme

Source

WalletConnect Core

Core Library for WalletConnect

This library is shared with the Browser Client and React-Native Client

For more details, read the documentation

Keywords

FAQs

Last updated on 02 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc